<?php
class GetSortList_model extends Model{
	
	function GetSortList_model ()
	{
		parent::Model();
	}
	
	function getList_parent($sort_id)
	{
		$this->db->select('*,
                          ci_ask_ccat.name as cname,
                          ci_ask_ccat.id ascid,
                          ci_ask_pcat.name as pname,
                          ci_ask_pcat.id as pid,
                          ci_ask_question.id as qid');
       $this->db->join('ci_ask_ccat','ci_ask_ccat.pid = ci_ask_pcat.id');
       $this->db->join('ci_ask_question','ci_ask_ccat.id = ci_ask_question.cid');
       $this->db->where('ci_ask_ccat.pid',$sort_id);
       $query = $this->db->get('ci_ask_pcat');
       return $query->result();
	}
	
	function getList_child($sort_id)
	{
	   $this->db->select('*,
                          ci_ask_ccat.name as cname,
                          ci_ask_ccat.id ascid,
                          ci_ask_pcat.name as pname,
                          ci_ask_pcat.id as pid,
                          ci_ask_question.id as qid');
       $this->db->join('ci_ask_ccat','ci_ask_ccat.id = ci_ask_question.cid');
       $this->db->join('ci_ask_pcat','ci_ask_ccat.pid = ci_ask_pcat.id');
       $this->db->where('ci_ask_ccat.id',$sort_id);
       $query = $this->db->get('ci_ask_question');
       return $query->result();
	}
}
?>